﻿using System;
using System.Collections.Generic;
using System.Text;

using GolfSigma.Inventory.Model;

namespace GolfSigma.Inventory.Extension
{
    public static class PlayerExtension
    {
        /// <summary>
        /// Conver an integer (1-4) to the player enumeration.
        /// </summary>
        /// <param name="numPlayers"></param>
        /// <returns></returns>
        public static PlayerEnum ToPlayerEnum(int numPlayers)
        {
            if (numPlayers < 1 || numPlayers >= 5)
                return PlayerEnum.None;

            switch (numPlayers)
            {
                case 1: return PlayerEnum.Single;
                case 2: return PlayerEnum.Twosome;
                case 3: return PlayerEnum.Threesome;
                case 4: return PlayerEnum.Foursome;
                default: return PlayerEnum.None;
            }
        }
    }
}
